Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change [IU]256 arithmetic host functions to take *Val not *Object. #889

Merged
merged 3 commits into from
Jun 24, 2023

Conversation

graydon
Copy link
Contributor

@graydon graydon commented Jun 24, 2023

This changes the 256bit host arithmetic functions to take and return the Val versions rather than the Object versions. The purpose is to let the SDK ignore the small-vs-large case distinctions and just pass the values to the host, because 3 of the 4 cases in a binary arithmetic operator will involve an object anyways, and it's just needless code bloat to do the 4-way-switch in the guest.

I also added a bunch of convenience infallible const member functions on [IU]{64,128,256}Small types to allow constructing them directly from [iu]32 to make it cheaper in contracts that want "small bignum" immediates like 0, +/- 1 or whatever.

PR is still waiting on a change @dmkozh is working on to adapt the test wasms to allow regeneration, but otherwise I think it's mostly in the right shape. cc @jayz22

@graydon graydon requested a review from jayz22 June 24, 2023 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants